<template>
  <div>
    <city-header :cities='cities'></city-header>
    <city-list :hotCity="hosCity" :cities='cities' :lessCity='lessCity'></city-list>
    <city-right :cities='cities' @change='handelCity'></city-right>
  </div>
</template>

<script>
import ajax from 'axios'
import CityHeader from './commpotens/City_Header.vue'
import CityList from './commpotens/City_List.vue'
import CityRight from './commpotens/City_right.vue'
export default {
  name: 'City',
  components: {
    CityHeader,
    CityList,
    CityRight
  },
  data () {
    return {
      hosCity: [],
      cities: {},
      lessCity: ''
    }
  },
  methods: {
    getCityInfo () {
      ajax.get('/api/city.json').then(this.getInfoSucc)
    },
    getInfoSucc (ref) {
      ref = ref.data
      if (ref.ret && ref.data) {
        this.hosCity = ref.data.hotCities
        this.cities = ref.data.cities
      }
    },
    handelCity (less) {
      this.lessCity = less
    }
  },
  mounted () {
    this.getCityInfo()
  }
}
</script>

<style lang="stylus" scoped>
</style>
